from django.shortcuts import HttpResponseRedirect, HttpResponse
from phones import models
import json


def catSort(request):
    brand = models.BrandCategory.objects.all()
    brandList = []
    for i in brand:
        obj = {
            "id": i.id,
            "b_name": i.b_name
        }
        brandList.append(obj)
    jsondata = json.dumps(brandList)
    return HttpResponse(jsondata)
